<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 引入easyui 的主题样式  和  easyui 提供的图标样式 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/icon.css" />
<!-- 引入jquery 和  easyui.js   中文设置js-->
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>

</head>
<script type="text/javascript">
$(function(){
	//配置数据表格
	$('#dg').datagrid({    
	    url:'select',    
	    columns:[[
            {field:'ck',width:100,checkbox:true},     
	        {field:'id',title:'sid',width:100,hidden:true},    
	        {field:'name',title:'学生姓名',width:100},    
	        {field:'age',title:'学生年龄',width:100,align:'right'},
	        {field:'address',title:'学生地址',width:100},
	        {field:'bid',title:'学生班级',width:100},
	        {field:'pnumber',title:'学生电话',width:100},
	        {field:'sex',title:'学生性别',width:100},
	        {field:'time',title:'学生入学时间',width:100}
	    ]],
	      toolbar: [{
			iconCls: 'icon-edit',
			text:'修改',
			handler: function(){
				
				var stus = $('#dg').datagrid('getSelections');
				if (stus.length == 1) {
					$("#log").dialog('open');
					$("#sname").val(stus[0].name);
					$("#sage").val(stus[0].age);
					$("#sid").val(stus[0].id);
					$("#saddress").val(stus[0].address);
					$("#ssex").val(stus[0].sex);
					/* $("#stime").val(stus[0].time); */
					$('#stime').datebox('setText',stus[0].time);
					$("#spnumber").val(stus[0].pnumber);
					//修改的请求
					$("#myfrom").form({
						url : 'update',
						success : function(data) {
							if(data==1){
								 $.messager.confirm({
						    			title:'信息提示',
						    			msg:'修改成功',
						    			timeout:1000,
						    			showType:'slide'
						    		});
								 $('#dg').datagrid('reload');

								
							}
						}
					});
					$("#bn1").linkbutton({
						onClick : function() {
							$("#myfrom").submit();
							$("#log").dialog('close');
							$('#dg').datagrid('reload');
						}
					});
					
			}	
				

			}
	
	    }] 
	    
	    
	    
	    
	})
		
}) 
	 




</script>
<body>
<table id="dg"></table>
 <!-- 修改当前学生个人信息 -->
<div id="log" class="easyui-dialog" title="修改个人信息"  closed="true">
		<form id="myfrom" method="post">
            <input id="sid" name="sid" type="text" style="display: none;">
            <br> 
			姓&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp名：<input id="sname" name="sname" type="text" style="width: 300px">
			<br> 
			年&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp龄：<input id="sage" name="sage" type="text"style="width: 300px"> 
			<br> 
			性&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp别：<input id="ssex" name="ssex" type="text" style="width: 300px">
			<br> 
			地&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp址：<input id="saddress" name="saddress" type="text"style="width: 300px"> 
		    <br> 
		             入学时间：<input id="stime" name="stime" class="easyui-datebox" type="text" style="width: 300px"> 
			<br> 
			电&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp话：<input id="spnumber" name="spnumber" type="text"style="width: 300px"> 
		    <br>		 	
            <a id="bn1" class="easyui-linkbutton">确认</a> 
            <a id="bn2" class="easyui-linkbutton">取消</a>
        </form>
	</div>
 
</body>
</html>